﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ASBCC.Workflow.K2Manager
{
    public class RedirectActionHandler : ActionHandlerBase
    {
        #region Constructor

        public RedirectActionHandler(SerializableDictionary dataFields, K2AppForm appForm, K2WorkItem workItem, K2ActionInfo actionInfo, string comment, K2AuditDestination auditDestination, List<K2User> outputDestinationUsers) :
            base(dataFields, appForm, workItem, actionInfo, comment, auditDestination, outputDestinationUsers)
        {
        }

        #endregion

        #region Override Methods
        /// <summary>
        /// 执行流程动作
        /// AskForMore动作不涉及K2
        /// </summary>
        protected override void ExcuteAction()
        {
            int toUserId = AuditDestination.ActivityDestinationList[0].UserArr[0];
            string fromUserName = WorkItem.Destination;
            string toUserName = K2Helper.GetDestinationName(toUserId);
            int procInstID = WorkItem.ProcInstId;
            int actInstDestID = WorkItem.ActInstDestId;
            K2Admin.RedirectWorklistItem(fromUserName, toUserName, procInstID, actInstDestID, 0);
        }

        protected override void BuildLeadingTime()
        {
        }

        protected override void BuildProcessComment()
        {
        }

        protected override void BuildProcessStamp()
        {
        }

        protected override void SendMail()
        {
        }

        protected override string GetActionType()
        {
            return "Redirect";
        }

        #endregion
    }
}
